package com.flying.oop.classmember.blockorder;

/**
 * @ClassName: Son
 * @author: 刘鹏飞
 * @date 2023/7/18 18:55
 * @Description:
 */
public class Son extends Father {
    static String x = "hello";

    static {
        System.out.println("我是son里的静态代码块");
        printY();
        printX();

    }

    static String y = "yes";

    private static void printY() {
        System.out.println("打印的值是" + y);
    }

    private static void printX() {
        System.out.println("打印的值是" + x);
    }

    int a = 10;

    {
        System.out.println("对象初始化:构造代码块被调用了");
        System.out.println(a);
        printB();

    }

    int b = 20;

    void printB() {
        System.out.println(b);
    }

    public Son() {
        // super() 调用父类无参的构造方法，初始化父类空间
        System.out.println("Son构造方法被调用了");
    }
}
